include<tools/util.scad>
$fn=100;


base_box();
translate([-20,0,0])screw_cap(ch=17.2);
translate([-30,-20,2.4])sticks();
translate([0,-80,10])rotate([0,90,0])slip_block();
translate([-40,-40,0])slip_rod();
translate([-30,30,0])rod_cap();

module base_box(){
    difference(){
        translate([1,1,1])minkowski(){
            cube([98,58,28]);//100,60,30
            sphere(1);
        }
        translate([10,0,8])cube([90,60,22]);
        translate([10,22,0])cube([88,16,9]);
        translate([2.7,30,13])rotate([90,0,90])screw_mask(ch=17);
        //螺杆洞
        translate([0,30,13])rotate([0,90,0])cylinder(h=12,d=5.2);
        //滑轨洞
        translate([0,30,4.1])rotate([0,90,0])cylinder(h=101,d=5.2);
        posx=[8,18,42,52];
        for(i=[0:3]){
            translate([5,posx[i],24])cylinder(h=7,d=5);
        }
    }
        //固定脚
    difference(){
        translate([50,-20,0])cube([10,22,3]);
        translate([55,-10,0])cylinder(h=5,d=5);
    }
    difference(){
        
        translate([50,58,0])cube([10,22,3]);
        translate([55,70,0])cylinder(h=5,d=5);
    }

}

module slip_block(){
    
    difference(){
        translate([1,1,1])minkowski(){
            cube([8,58,28]);//10,60,30
            sphere(1);
       }
            cube([10,22.1,8]);
            translate([0,37.9,0])cube([10,22.1,8]);
            translate([0,30,13])rotate([0,90,0])cylinder(h=12,d=5.2);
            //滑轨洞
        translate([0,30,4.1])rotate([0,90,0])cylinder(h=101,d=5.2);
            posx=[8,18,30,42,52];
            for(i=[0:4]){
                translate([5,posx[i],24])cylinder(h=7,d=5);
            }

        }
}

module screw_mask(ch=20){
    d_six_side_cube(edge=4.5,height=4.6);
    translate([-4.5,0,0])cube([9,ch,4.6]);
}
module screw_cap(ch=20){
    difference(){
        translate([-4.25,0,0])cube([8.5,ch,4.4]);
        d_six_side_cube(edge=4.25,height=4.4);
    }
}
module sticks(){
    rotate([0,90,0])cylinder(h=22,d=4.7);

}
module slip_rod(){
    translate([0,0,2.5])rotate([-90,0,0])cylinder(h=110,d=4.8);

}
module rod_cap(){
        translate([10,5,0])difference(){
        cylinder(h=5,d=7.8);
        cylinder(h=5,d=5.1);
    }

}
